<template>
	<view class="audio-box">
		<view class="start-taste-line">
			<view v-for="(_, i) in new Array(lineLength)" :class="!animation ? `line${i + 1}` : `line line${i + 1}`"
				:style="{backgroundColor: color}" />
		</view>
	</view>
</template>

<script>
	export default {
		name: "audio-animation",
		data() {
			return {

			};
		},
		props: {
			lineLength: {
				default: 11
			},
			animation: {
				default: false
			},
			color: {
				default: '#333'
			}
		}
	}
</script>

<style>
	.audio-box .start-taste-line {
		display: flex;
		align-items: center;
	}

	.audio-box .start-taste-line view {
		background-color: #333;
		width: 6rpx;
		height: 8rpx;
		margin: 0 4rpx;
		display: inline-block;
		border-radius: 2rpx;
	}

	.line {
		animation: note 0.2s ease-in-out;
		animation-iteration-count: infinite;
		animation-direction: alternate;
	}

	.line1 {
		transform: scaleY(2);
		animation-delay: -1s;
	}

	.line2 {
		transform: scaleY(3);
		animation-delay: -0.9s;
	}

	.line3 {
		transform: scaleY(4);
		animation-delay: -0.8s;
	}

	.line4 {
		transform: scaleY(3);
		animation-delay: -0.7s;
	}

	.line5 {
		transform: scaleY(2);
		animation-delay: -0.6s;
	}

	.line6 {
		transform: scaleY(3);
		animation-delay: -0.5s;
	}

	.line7 {
		transform: scaleY(4);
		animation-delay: -0.4s;
	}

	.line8 {
		transform: scaleY(3);
		animation-delay: -0.3s;
	}

	.line9 {
		transform: scaleY(2);
		animation-delay: -0.2s;
	}

	.line10 {
		transform: scaleY(3);
		animation-delay: -0.1s;
	}

	.line11 {
		transform: scaleY(4);
		animation-delay: 0s;
	}

	.line12 {
		transform: scaleY(3);
		animation-delay: 0.1s;
	}

	.line13 {
		transform: scaleY(4);
		animation-delay: 0.2s;
	}

	.line14 {
		transform: scaleY(3);
		animation-delay: 0.3s;
	}

	.line15 {
		transform: scaleY(4);
		animation-delay: 0.4s;
	}

	.line16 {
		transform: scaleY(3);
		animation-delay: 0.5s;
	}

	.line17 {
		transform: scaleY(4);
		animation-delay: 0.4s;
	}

	.line18 {
		transform: scaleY(3);
		animation-delay: 0.3s;
	}

	.line19 {
		transform: scaleY(2);
		animation-delay: 0.2s;
	}

	.line20 {
		transform: scaleY(3);
		animation-delay: 0.1s;
	}

	.line21 {
		transform: scaleY(4);
		animation-delay: 0.6s;
	}

	.line22 {
		transform: scaleY(3);
		animation-delay: 0.5s;
	}

	.line23 {
		transform: scaleY(2);
		animation-delay: 0.4s;
	}
	
	.line24 {
		transform: scaleY(3);
		animation-delay: 0.3s;
	}


	@keyframes note {
		from {
			transform: scaleY(1);
		}

		to {
			transform: scaleY(4);
		}
	}
</style>